#@homejs() 
#@homemenu("")
<div align="center" style="width:100%;background:#fafafa">
	<div style="width:1060px;min-height:600px;padding:20px 0;"> 
		<div align="left" style="width:1060px;padding:20px 0 0 20px;;height:30px;background:#FFF">
			<span seleinfo1="2016-01-01 00:00:00" seleinfo2="2016-12-31 23:59:59" class="invest invest_time1 ">2018</span> 
			<span seleinfo1="2017-01-01 00:00:00" seleinfo2="2017-12-31 23:59:59" class="invest invest_time1 invest_time">2017</span> 
		</div>
		 
		<!--标的列表-->
		<div align="left" style="padding:10px 20px 20px 20px;;width:1040px;height:600px;background:#FFF;">
			<div style="line-height:50px;font-size:14px;height:550px;"> 
				<div id="rewardlist">
					
				</div>
			</div>
			<!--分页-->
			<div align="center" style="font-size:14px;height:50px;width:100%;padding-bottom:10px;background:#FFF;line-height:50px;">
				<span id="firstpage" style="cursor:pointer;padding:5px 10px 5px 10px;border:1px solid #ebebeb;border-radius:5px 0 0 5px;">
					首页
				</span>
				<span id="backpage" style="cursor:pointer;padding:5px 10px 5px 10px;border:1px solid #ebebeb;">
					上一页
				</span>
				<span style="padding:5px 10px 5px 10px;border:1px solid #ebebeb;">
					第<span id="pageNumber"></span>页&nbsp&nbsp共<span id="totalPage"></span>页
				</span>
				<span id="nextpage" style="cursor:pointer;padding:5px 10px 5px 10px;border:1px solid #ebebeb;">
					下一页
				</span>
				<span id="lastpage" style="cursor:pointer;padding:5px 10px 5px 10px;border:1px solid #ebebeb;border-radius:0 5px 5px 0;">
					尾页
				</span>
				<span style="margin-left:50px;">第</span>
				<input id="pagenum" style="border:1px solid #ebebeb;border-radius:5px;height:32px;width:40px;padding:0 10px 0 10px;font-size:16px;"  /> 
				<span>页</span>
				<span id="gopage" style="cursor:pointer;padding:5px 10px 5px 10px;border:1px solid #ebebeb;border-radius:5px;">
					跳转
				</span>
			</div>
		</div>
	</div>
</div>
#@homefoot1()
#@homefoot2() 
<script id="demo" type="text/x-jquery-tmpl">
	<div align="center" onclick="window.open('/account-activeinfo?id=${id}')" style="cursor:pointer;padding-top:5px;margin-bottom:40px;float:left;width:390px;height:180px;margin-left:20px;border:1px solid #e8e8e8">
		<img style="width:380px;height:150px;" src="${image}">
		<div style="margin-top:10px;width:340px;height:50px;line-height:20px;background:#fafafa">
			<div style="padding:0 10px;" class="onellipsis" >${name}</div>
			<div style="padding:0 10px;" class="onellipsis" >${summary}</div>
		</div> 
	</div> 
</script>
<script>
	var createTimeStart="";       
	var createTimeEnd="";
	var pageNumber = "";
	var page = 1;
	var totalPage = "";
	//时间筛选--
	mytradelist(page,createTimeStart,createTimeEnd);
	$(".invest_time1").click(function(){
		$(".invest_time1").removeClass("invest_time"); 
		$(this).addClass("invest_time");
		createTimeStart = $(this).attr("seleinfo1");
		createTimeEnd = $(this).attr("seleinfo2");
		$("#rewardlist").empty();
		mytradelist(page,createTimeStart,createTimeEnd);
	});
	$(".yuefen").click(function(){
		createTimeStart=$("#startime").val();
		createTimeEnd=$("#endtime").val();
		$("#rewardlist").empty();
		mytradelist(page,createTimeStart,createTimeEnd);
	});
	$("#coupontype").change(function(){
		var coupontype = $("#coupontype").val();
		$("#rewardlist").empty();
		mytradelist(page,createTimeStart,createTimeEnd);
	});
	//持有与已完成转换
	$(".userinvest2").click(function(){
		$(".userinvest2").removeClass("userinvest"); 
		$(".userinvest2").css("background","#f4f5fa");
		$(this).addClass("userinvest");
		$(this).css("background","#FFF");
		types = $(this).attr("seleinfo1");
		$("#rewardlist").empty(); 
		mytradelist(page,createTimeStart,createTimeEnd);
		
	});
	//上一页
	$("#backpage").click(function(){
		page = page-1;
		if(page <= 0){
			layer.msg("当前已是首页！",{icon:2,time:1000}); 
		}else{
			$("#rewardlist").empty();
			mytradelist(page,createTimeStart,createTimeEnd);
		}
	}); 
	//下一页
	$("#nextpage").click(function(){
		page = page + 1;
		if(page > totalPage){
			layer.msg("当前已是尾页！",{icon:2,time:1000}); 
		}else{
			$("#rewardlist").empty();
			mytradelist(page,createTimeStart,createTimeEnd);
		}
	}); 
	//首页
	$("#firstpage").click(function(){
		page = 1;
		$("#rewardlist").empty();
		mytradelist(page,createTimeStart,createTimeEnd);
	}); 
	//尾页
	$("#lastpage").click(function(){
		page = totalPage;
		$("#rewardlist").empty();
		mytradelist(page,createTimeStart,createTimeEnd);
	});  
	//跳转
	$("#gopage").click(function(){
		page = Number($("#pagenum").val());
		if(page > totalPage || page < 1 ){
			layer.msg("输入页数不在区间内！",{icon:2,time:1000}); 
		}else{ 
			$("#rewardlist").empty();
			mytradelist(page,createTimeStart,createTimeEnd);
		}
	});
	function mytradelist(page,createTimeStart,createTimeEnd){  
		$.getJSON("#(path)/notice/list?token=#(session.token??)&type=report&size=6&page="+page+"&createTimeStart="+createTimeStart+"&createTimeEnd="+createTimeEnd, function(datalist) { 
			totalPage = datalist.data.page.totalPage;
			pageNumber = datalist.data.page.pageNumber;
			if(totalPage==0){
				totalPage = 1;
			}
			if(pageNumber==0){
				pageNumber = 1;
			}
			$("#totalPage").html(totalPage);
			$("#pageNumber").html(pageNumber); 
			$.each(datalist.data.page.list, function(i, item){ 
				
				var invests = {id:item.id,summary:item.summary,image:item.image,name:item.name};
				$("#demo").tmpl(invests).appendTo('#rewardlist');
			});
		});
	}
</script>